package com.machine.action.admin;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.opensymphony.xwork2.ActionSupport;

@Component("adminLogin")
@Scope("prototype")
public class AdminLogin extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private String username;
	private String password;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@Override
	public String execute() throws Exception {
		if(username.equals("admin")&&password.equals("admin")){
			return SUCCESS;
		}else{
			ServletActionContext.getResponse().getWriter().print("passwod or username error, please try again");
			return ERROR;
		}
		
	}
}
